package com.cuit.freshmanMS.controller;

import com.cuit.freshmanMS.util.result.CommonResult;
import com.cuit.freshmanMS.util.result.ResultUtil;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description:
 * @author: ziger
 * @time: 2024/1/12 11:46
 */
@RestController
public class TestController {

    @GetMapping("/test")
    CommonResult<String> test(){
        // 返回封装好的数据（最终结果是json）
        return ResultUtil.success("Success!");
    }

    @PostMapping("/upload")
    public String uploadFile(@RequestParam("file") MultipartFile file) {
        // 处理上传的文件
        System.out.println(file.getSize());
//        Workbook wb = new XSSFWorkbook(file.getInputStream());

        return "文件上传成功";
    }
}
